package com.fbinggun.fbinggunutil.fgive;

import com.fbinggun.fbinggunutil.FBinggunUtil;
import com.fbinggun.fbinggunutil.FPluginModule;
import com.fbinggun.fbinggunutil.Lang;
import com.fbinggun.fbinggunutil.fgive.command.FgiveCommand;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;
import java.io.IOException;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

public class Fgive extends FPluginModule {

    public  FBinggunUtil plugin;
    private FgiveItemSQL fgiveItemSQL;
    public Util util;
    public Lang lang;
    private FgiveAPI api;


    public void onEnable() {
        this.plugin=FBinggunUtil.plugin;
        api=new FgiveAPI(this);
        util=new Util(this);
        reload();
        this.plugin. getLogger().info("Five()模块启动");
    }

    @Override
    public void onDisable() {

    }

    @Override
    public void onLoad() {

    }

    public FgiveItemSQL getFgiveItemSQL() {
        return fgiveItemSQL;
    }

    public void reload(){
        if (! this.plugin.getDataFolder().exists()) {
            this.plugin.getDataFolder().mkdir();
        }
        FgiveCommand fgiveCommand = new FgiveCommand(this.plugin,"fgive");
        lang =new Lang(plugin.getLanguage().getConfigurationSection("FGive"));
        try {
            fgiveItemSQL= new FgiveItemSQL(this.plugin.getSql(),this);
        } catch (SQLException | ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
    }

    public Util getUtil() {
        return util;
    }

    public Lang getLang() {
        return lang;
    }

    public FgiveAPI getApi() {
        return api;
    }
}




